﻿{include file="public/header" /}
<link rel="stylesheet" href="/web/static/admin/css/amazeui.min.css" />
<script src="/web/static/admin/js/amazeui.min.js"></script>
<script src="/web/static/public/js/echarts.js"></script>
<div style="margin-left:40px;margin-top: 20px">
	<script>
        //city 参数和回调
        var pid="{:input('get.pid')}";
        var cid="{:input('get.cid')}";
        var aid="{:input('get.aid')}";
        var selectc = true;
        var selecta = true;
        function select_p(){
            return false;
        }
        function select_c(){
            return false;
        }
        function select_a(){
            location.href="?pid="+pid+"&cid="+cid+"&aid="+aid;
        }
	</script>
	{:lang('label')['select']}{:lang('currency')['city']}：{include file="public/city" /}
	{if input('get.aid')}
		<div style="float: right;margin-right: 15px;color: red;">
			客服电话：{$service_phone}
			<a href="javascript:edit()">更改</a>
		</div>
	{/if}
</div>
<div class="row" style="width: 90%;margin-left: 20px;margin-top:20px;height: 100%">
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
		<div class="dashboard-stat blue">

			<div class="details">
				<!--<div class="number"> 2,985,465 </div>-->
				<div class="desc"> 总订单数量 </div>
				<div class="number"> {$data.sum_order_count} </div>

			</div>

		</div>
	</div>
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
		<div class="dashboard-stat red">

			<div class="details">
				<!--<div class="number"> 6533 </div>-->
				<div class="desc"> 今日订单量 </div>
				<div class="number"> {$data.today_order_count} </div>

			</div>

		</div>
	</div>
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
		<div class="dashboard-stat purple">
			<div class="details">
				<!--<div class="number"> 78699 </div>-->
				<div class="desc"> 配送员人数 </div>
				<div class="number"> {$data.express_total} </div>

			</div>

		</div>
	</div>
	<div class="am-u-lg-3 am-u-md-6 am-u-sm-12" style="width: 25%;float:left;">
	<div class="dashboard-stat green">
		<div class="details">
			<!--<div class="number"> 78699 </div>-->
			<div class="desc"> 今日收益 </div>
			<div class="number"> {$data.money_total} </div>

		</div>

	</div>
</div>
</div>
<div id="rectangle" style="width: 45%;height:400px;float: left"></div>
<div id="circle" style="width: 45%;height: 400px;float: left"></div>
<script>
    var rectangle = echarts.init(document.getElementById("rectangle"));

    var date_string = '{$date_array}';
    var date_array = date_string.split(',');

    var date_data = '{$date_data}';
    var date_date_array = date_data.split(',');

    // 指定图表的配置项和数据
    option = {
        color: ['#27a9ff'],
        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                data : date_array,
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis : [
            {
                type : 'value'
            }
        ],
        series : [
            {
                name:'订单量',
                type:'bar',
                barWidth: '50%',
                data:date_date_array
            }
        ]
    };
    rectangle.setOption(option);


    var circle = echarts.init(document.getElementById("circle"));
    option = {
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        series : [
            {
                name: '交易额',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[
                    {$date_money_total_string}
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    circle.setOption(option);


    layer.config({
        extend: 'extend/layer.ext.js'
    });
    function edit() {
        layer.prompt({title:'更改客服电话'},function(val){
            location.href="__URL__/home?service_phone="+val+"&pid={:input('get.pid')}&cid={:input('get.cid')}&aid="+aid;
        });
    }
</script>
